import http from '@/utils/http'

export function roleApi(data, params) {
  return http.request({
    url: '/api/role/getAll',
    method: 'POST',
    data,
    params
  })
}

export function roleDeleteApi(_id) {
  return http.request({
    url: `/api/role/${_id}`,
    method: 'DELETE',
  })
}

export function roleDetailApi(_id) {
  return http.request({
    url: `/api/role/${_id}`,
    method: 'GET',
  })
}

export function roleAddApi(data) {
  return http.request({
    url: `/api/role`,
    method: 'POST',
    data,
  })
}

export function roleUpsertApi(data) {
  return http.request({
    url: `/api/role/${data?.id}`,
    method: 'PUT',
    data,
  })
}